package com.telrob.bytevm;

import com.telrob.antlr.XnCompile;
import com.telrob.bytevm.compile.Compile;
import com.telrob.bytevm.vm.VM;

public class App {
    public static void main( String[] args ){
        try {
        	//System.err.println("hello XN");
        	if(args.length<2) {
        		System.err.println("java -jar XX.jar compile main.c");
        		System.err.println("java -jar XX.jar build main.xn");
        		System.err.println("java -jar XX.jar run main.bin");
        		return;
        	}
        	if("build".equals(args[0])||"b".equals(args[0])) {
        		String name=args[1];
        		Compile.compile(name);
        	}else if("run".equals(args[0])||"r".equals(args[0])) {
        		String name=args[1];
        		VM vm=new VM(name);
        		vm.run();
        	}else if("compile".equals(args[0])||"c".equals(args[0])){
        		String name=args[1];
        		XnCompile.compileCode(name);
        	}
        	
        	
        } catch (Exception e) {
			e.printStackTrace();
		}
    }
}
